import com.zy.mainApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.Duration;

/**
 * @author 张宇
 * @date 2021/7/27 18:14
 */
@SpringBootTest
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = mainApplication.class)
public class redis {

    @Autowired
    RedisTemplate redisTemplate;

    @Test
    public void test(){
        //redisTemplate.opsForValue().set("2","dsdd", Duration.ofMinutes(30L));
        System.out.println(redisTemplate.opsForValue().get("e57a689f-ceb8-4712-ad4f-e499107e812d"));
    }

    @Test
    public void delete(){
        redisTemplate.opsForValue().set("11f1ed26-b615-4668-9f74-a41baab5afdc","admin",Duration.ofMillis(1L));
        System.out.println(redisTemplate.opsForValue().get("11f1ed26-b615-4668-9f74-a41baab5afdc"));
    }

}
